# -*- coding: utf-8 -*-
import os
import re
import sys
import time
import ctypes

def str2AutoNum(s):
    try:
        if type(eval(s)) == float:
            return float('%.1f'%(float(s)))
        return int(s)
    except ValueError:
        pass
    except NameError:
        pass

    return s

def csvLineParser(lineStr):
    # print(lineStr)
    lineLists = re.split('[,\n ]', lineStr.strip())
    lineLists = list(filter(None, lineLists))

    parserData = []
    for i in lineLists:
        parserData.append(str2AutoNum(i))

    # print('src:\n'+lineStr + '\nparser:')
    # print(lineLists)
    # print('\nline data:')
    # print(parserData)

    return parserData
